<?php require VIEWPATH. ADMIN_DIR. DIRECTORY_SEPARATOR. 'header.php'?>
<style type="text/css">
	th{text-align: center;background-color: #b7dde8;color: black}
	td{text-align: center;vertical-align: middle !important;background-color: #b7dde8}
	tr:nth-child(even) td{background-color: #dbeef4}
	th,td{border-color: white !important;height: 30px;}
</style>
<div class="page-header" style="margin-bottom: 0px;">
	<h1 style="font-size: 20px;">
		<a class="a-back" href="<?= admin_url('contents/schedule') ?>">
            <i class="fa fa-reply"></i>
		</a>
		<?=$classInfo['class_name']?> 课程表
	</h1>
</div>
<div class="col-xs-10" style="font-size: 15px;">
	<div>
		<!-- <ul class="nav nav-tabs padding-18 hidden">
			<li class="active">
				<a data-toggle="tab" href="#this-week" aria-expanded="true">
					<i class="green ace-icon fa fa-table bigger-120"></i> 本周课程表
				</a>
			</li>
			<li class="">
				<a data-toggle="tab" href="#next-week" aria-expanded="false">
					<i class="orange ace-icon fa fa-table bigger-120"></i> 下周课程表
				</a>
			</li>
		</ul> -->
		<?php if(!empty($thisWeek) && isset($thisWeek['schedule_time_json']) && !empty(json_decode($thisWeek['schedule_time_json']))): ?>
			<div id="this-week" class="tab-pane active">
				<h4 class="widget-title blue smaller">
					<i class="ace-icon fa fa-rss orange"></i> <?=$thisWeek['schedule_title']?>
				</h4>
				<table class="table table-striped table-bordered">
					<thead>
						<tr>
							<th width="5%"></th>
							<th width="10%">时间</th>
							<?php for($i = 1; $i <= $thisWeek['schedule_week_days']; $i++): ?>
								<th width="10%"><?=get_week_name_from_number($i)?></th>
							<?php endfor; ?>
						</tr>
					</thead>
					<tbody>
						<?php $timeJson = json_decode($thisWeek['schedule_time_json'], true); ?>
							<?php foreach($timeJson as $key => $time): ?>
								<tr>
									<!-- 早读 -->
									<?php if($key == 0 && $thisWeek['schedule_early_morning_number'] > 0): ?>
										<td rowspan="<?=$thisWeek['schedule_early_morning_number']?>">早间</td>
									<?php endif; ?>
									<!-- 上下午 -->
									<?php if($key == $thisWeek['schedule_early_morning_number'] && $thisWeek['schedule_morning_number'] > 0): ?>
										<td rowspan="<?=$thisWeek['schedule_morning_number']?>">上午</td>
									<?php endif; ?>
									<?php if($key == ($thisWeek['schedule_early_morning_number'] + $thisWeek['schedule_morning_number']) && $thisWeek['schedule_afternoon_number'] > 0): ?>
										<td rowspan="<?=$thisWeek['schedule_afternoon_number']?>">下午</td>
									<?php endif; ?>
									<!-- 晚修 -->
									<?php if($key == ($thisWeek['schedule_early_morning_number'] + $thisWeek['schedule_morning_number'] + $thisWeek['schedule_afternoon_number']) && $thisWeek['schedule_night_number'] > 0): ?>
										<td rowspan="<?=$thisWeek['schedule_night_number']?>">晚间</td>
									<?php endif; ?>
									
									<!-- 时间字段 -->
									<td><?=$time['beginTime']?> - <?=date("H:i", strtotime($time['beginTime']) + $time['duration'] * 60)?></td>
									<!-- 科目字段 -->
									<?php for($i = 1; $i <= $thisWeek['schedule_week_days']; $i++): ?>
										<td>
											<?php $lessonIndex = $i. ($key + 1);?>
											<?php if(isset($thisWeek['lesson'][$lessonIndex])): ?>
												<?=$thisWeek['lesson'][$lessonIndex]['schedule_lesson']?>
												<br />
												<span class="brown"><?=$thisWeek['lesson'][$lessonIndex]['roomName']. " ". $thisWeek['lesson'][$lessonIndex]['teacherName']?></span>
											<?php endif; ?>
										</td>
									<?php endfor; ?>
								</tr>
							<?php endforeach; ?>	
					</tbody>
				</table>
			</div>
		<?php else: ?>
			<!-- <div id="this-week" class="tab-pane active"> -->
			<div>
				<h3 style="color: #9D9D9D;">暂无本周课程数据</h3>
			</div>
		<?php endif ?>
	</div>
</div>

<?php require VIEWPATH. ADMIN_DIR. DIRECTORY_SEPARATOR. 'footer.php'?>